import mimetypes

from django.contrib import admin
from django.http import HttpResponse
from django.urls import include, path, re_path


def handelFile(request, path):
    type, encoding = mimetypes.guess_type(path)
    return HttpResponse(open("files/" + path, "rb"), content_type=type)


urlpatterns = [
    path('admin/', admin.site.urls),
    path("user/", include('User.urls')),
    path("friend/", include('Friend.urls')),
    re_path(r'^files/(?P<path>.*)$', handelFile),
]
